
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>我的收货地址</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Cache-Control" content="no-transform">
		<meta name="format-detection" content="telephone=no">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" href="style/css/basic.css">
		<link rel="stylesheet" href="style/css/address.css" />
		<script type="text/javascript" src="style/plugin/mui/js/mui.min.js"></script>
		<script type="text/javascript" src="style/js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="style/js/vue.min.js"></script>
		<script type="text/javascript" src="style/js/vue-resource.js"></script>
		<script type="text/javascript" src="style/js/md5.js"></script>
		<script type="text/javascript" src="style/js/basic.js"></script>
	</head>

	<body>
		<div id="address">
		    <div id="header">
				<h1>我的收货地址</h1>
				<span class="backicon"></span>
				<span class="righttxt"><a href="javascript:;" class="maincolor" @tap="jumpadd">添加新地址</a></span>
			</div>
			<div class="body">
				<div class="add">
					<div class="address" v-for="(adr,index) in myMsg">  
						<ul>
							<li>
								<p>
									<div class="name">{{adr.name}}</div><!--{{seladdr.child.cId[index].name}}-{{seladdr.child.cId[index].child.aId[index].name}}-{{adr.address}}-->
									<div class="tel">{{adr.phone}}</div>
								</p>
								<p><em v-if="adr.is_default==1">[默认]</em>安徽省-{{seladdr[index]}}-{{seladdr2[index]}}-{{adr.address}}</p>
							</li>
						</ul>
						<div class="edit"><a href="javascript:;" @tap="jumpedit(index)" v-if="myMsg!=''">编辑</a></div>
					</div>
				</div>
			</div>	
		</div>
		<script src="style/js/anhui.js"></script>
		<script>
			new Vue({
				el:"#address", 
				data:{
					myMsg:"",
					ticket:"",
					sign:"",
					seladdr:[],
					seladdr2:[]
				},
				methods:{
					jumpedit:function(eIndex){
						openurl_can("edit_address",this.myMsg[eIndex].id)
					},
					jumpadd:function(){
						openurl_can("add_address",this.myMsg.id)
					}
				},
				created:function(){
					this.ticket=localStorage.getItem("tick")
                    this.sign=localStorage.getItem("sig")
                    var cId=[]
                    var aId=[]
					this.$http.post(domain+"/member_address/getList?t="+this.ticket+"&sign="+this.sign,{emulateJSON:true}).then( 
			            function (res) {
			                // 处理成功的结果
			                if(res.body.code==1){ 
			                  console.log(res.body)
			                  for(var i=0;i<res.body.data.length;i++){
			                  	cId[i]=res.body.data[i].city_id
			                  	aId[i]=res.body.data[i].area_id
			                  	console.log(cId[i])
			                  	var a=cId[i]
			                  	var b=aId[i]
			                  	this.seladdr[i]=region.child[a].name; 
			                  	this.seladdr2[i]=region.child[a].child[b].name;
			                  } 
			                  this.myMsg=res.body.data; 
			                  console.log(this.seladdr2)
			                } 
			            },function (res) {
			            // 处理失败的结果 
			            console.log(res) 
			            }
			        );
				},
				mounted:function(){
					
					console.log(this.seladdr)
				}
			})
		</script>
	</body>

</html>